using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WillStott.MxAppToolbox
{
	/// <summary>
	/// Summary description for UniMsgDlg.
	/// </summary>
	public class UniMsgDlg : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label labelNumber;
		private System.Windows.Forms.Label labelMsgId;

		private System.Windows.Forms.Label labelCause;
		private System.Windows.Forms.Label labelTip;
		private System.Windows.Forms.TextBox textBoxTip;
		private System.Windows.Forms.Label labelWhatToDo;
		private System.Windows.Forms.Button buttonOK;
		private System.Windows.Forms.Button buttonNo;
		private System.Windows.Forms.Button buttonYes;

		private System.Windows.Forms.PictureBox picBoxMsgCat;
		private System.Windows.Forms.ImageList imageListCat;
		private System.ComponentModel.IContainer components;

		public UniMsgDlg()
		{
			InitializeComponent();
		}

		public UniMsgDlg(UniMsg aMsg, UniException.Reset aReset, UniException.Category aCategory, string aFmt, params object[] aArgs)
		{
			InitializeComponent();

			if ( imageListCat.Images.Count > (int)aCategory )
				picBoxMsgCat.Image = imageListCat.Images[(int)aCategory]; 

			labelMsgId.Text = aMsg.MsgId;
			labelCause.Text = aMsg.Cause;
			textBoxTip.Text = aMsg.Tip;
			labelWhatToDo.Text = aMsg.WhatToDo;

			buttonOK.Visible = (aReset == UniException.Reset.AbortOp)? true : false;
			buttonYes.Visible = (aReset == UniException.Reset.AbortOp)? false : true;
			buttonNo.Visible = (aReset == UniException.Reset.AbortOp)? false : true;
		}

		private void buttonYes_Click(object sender, System.EventArgs e)
		{
			this.DialogResult = DialogResult.Yes;
			this.Close();
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UniMsgDlg));
            this.buttonOK = new System.Windows.Forms.Button();
            this.picBoxMsgCat = new System.Windows.Forms.PictureBox();
            this.labelWhatToDo = new System.Windows.Forms.Label();
            this.labelTip = new System.Windows.Forms.Label();
            this.labelCause = new System.Windows.Forms.Label();
            this.labelMsgId = new System.Windows.Forms.Label();
            this.buttonNo = new System.Windows.Forms.Button();
            this.labelNumber = new System.Windows.Forms.Label();
            this.textBoxTip = new System.Windows.Forms.TextBox();
            this.imageListCat = new System.Windows.Forms.ImageList(this.components);
            this.buttonYes = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.picBoxMsgCat)).BeginInit();
            this.SuspendLayout();
            // 
            // buttonOK
            // 
            this.buttonOK.AccessibleDescription = null;
            this.buttonOK.AccessibleName = null;
            resources.ApplyResources(this.buttonOK, "buttonOK");
            this.buttonOK.BackgroundImage = null;
            this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonOK.Font = null;
            this.buttonOK.Name = "buttonOK";
            // 
            // picBoxMsgCat
            // 
            this.picBoxMsgCat.AccessibleDescription = null;
            this.picBoxMsgCat.AccessibleName = null;
            resources.ApplyResources(this.picBoxMsgCat, "picBoxMsgCat");
            this.picBoxMsgCat.BackgroundImage = null;
            this.picBoxMsgCat.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.picBoxMsgCat.Font = null;
            this.picBoxMsgCat.ImageLocation = null;
            this.picBoxMsgCat.Name = "picBoxMsgCat";
            this.picBoxMsgCat.TabStop = false;
            // 
            // labelWhatToDo
            // 
            this.labelWhatToDo.AccessibleDescription = null;
            this.labelWhatToDo.AccessibleName = null;
            resources.ApplyResources(this.labelWhatToDo, "labelWhatToDo");
            this.labelWhatToDo.Name = "labelWhatToDo";
            // 
            // labelTip
            // 
            this.labelTip.AccessibleDescription = null;
            this.labelTip.AccessibleName = null;
            resources.ApplyResources(this.labelTip, "labelTip");
            this.labelTip.Name = "labelTip";
            // 
            // labelCause
            // 
            this.labelCause.AccessibleDescription = null;
            this.labelCause.AccessibleName = null;
            resources.ApplyResources(this.labelCause, "labelCause");
            this.labelCause.ForeColor = System.Drawing.Color.Red;
            this.labelCause.Name = "labelCause";
            // 
            // labelMsgId
            // 
            this.labelMsgId.AccessibleDescription = null;
            this.labelMsgId.AccessibleName = null;
            resources.ApplyResources(this.labelMsgId, "labelMsgId");
            this.labelMsgId.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
            this.labelMsgId.Name = "labelMsgId";
            // 
            // buttonNo
            // 
            this.buttonNo.AccessibleDescription = null;
            this.buttonNo.AccessibleName = null;
            resources.ApplyResources(this.buttonNo, "buttonNo");
            this.buttonNo.BackgroundImage = null;
            this.buttonNo.DialogResult = System.Windows.Forms.DialogResult.No;
            this.buttonNo.Font = null;
            this.buttonNo.Name = "buttonNo";
            // 
            // labelNumber
            // 
            this.labelNumber.AccessibleDescription = null;
            this.labelNumber.AccessibleName = null;
            resources.ApplyResources(this.labelNumber, "labelNumber");
            this.labelNumber.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
            this.labelNumber.Name = "labelNumber";
            // 
            // textBoxTip
            // 
            this.textBoxTip.AccessibleDescription = null;
            this.textBoxTip.AccessibleName = null;
            resources.ApplyResources(this.textBoxTip, "textBoxTip");
            this.textBoxTip.BackgroundImage = null;
            this.textBoxTip.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBoxTip.Font = null;
            this.textBoxTip.Name = "textBoxTip";
            this.textBoxTip.ReadOnly = true;
            // 
            // imageListCat
            // 
            this.imageListCat.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListCat.ImageStream")));
            this.imageListCat.TransparentColor = System.Drawing.Color.Transparent;
            this.imageListCat.Images.SetKeyName(0, "");
            this.imageListCat.Images.SetKeyName(1, "");
            this.imageListCat.Images.SetKeyName(2, "");
            this.imageListCat.Images.SetKeyName(3, "");
            this.imageListCat.Images.SetKeyName(4, "");
            // 
            // buttonYes
            // 
            this.buttonYes.AccessibleDescription = null;
            this.buttonYes.AccessibleName = null;
            resources.ApplyResources(this.buttonYes, "buttonYes");
            this.buttonYes.BackgroundImage = null;
            this.buttonYes.DialogResult = System.Windows.Forms.DialogResult.Yes;
            this.buttonYes.Font = null;
            this.buttonYes.Name = "buttonYes";
            this.buttonYes.Click += new System.EventHandler(this.buttonYes_Click);
            // 
            // UniMsgDlg
            // 
            this.AcceptButton = this.buttonOK;
            this.AccessibleDescription = null;
            this.AccessibleName = null;
            resources.ApplyResources(this, "$this");
            this.BackgroundImage = null;
            this.CancelButton = this.buttonNo;
            this.Controls.Add(this.buttonYes);
            this.Controls.Add(this.textBoxTip);
            this.Controls.Add(this.buttonOK);
            this.Controls.Add(this.picBoxMsgCat);
            this.Controls.Add(this.labelWhatToDo);
            this.Controls.Add(this.labelTip);
            this.Controls.Add(this.labelCause);
            this.Controls.Add(this.labelMsgId);
            this.Controls.Add(this.buttonNo);
            this.Controls.Add(this.labelNumber);
            this.Font = null;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = null;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "UniMsgDlg";
            this.ShowInTaskbar = false;
            ((System.ComponentModel.ISupportInitialize)(this.picBoxMsgCat)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

	}
}
